{extend name="layout/base" /}
<!-- 标题 -->
{block name="title"}模块管理{/block}
<!-- CSS -->
{block name="css"}{/block}
<!-- 具体内容 -->
{block name="content"}
<h2 class="header-dividing">模块管理 <small>Module list</small></h2>
<div class="navbar navbar-default navbar-content">
    <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
            {if(check_auth('module-create'))}<li><a data-toggle="modal" data-target="#modal-create" data-action="{:url('/module/save')}"> <i class="icon icon-plus"></i> 新增模块</a></li>{/if}
        </ul>
        <!-- 导航中的表单 -->
        <form class="navbar-form navbar-left" role="search" method="get" action="{:url('/module')}">
            <input type="text" class="form-control" placeholder="搜索" name="keywords" value="{$keywords}">
            <button type="submit" class="btn btn-default">搜索</button>
        </form>
    </div>
</div>
<div class="panel">
    <table class="table table-condensed datatable" data-checkable="true" data-fixed-left-width="250" data-fixed-right-width="260">
        <thead>
            <tr>
                <th data-width="50">ID</th>
                <th data-width="150">模块名称</th>
                <th class="flex-col" data-width="100">模块标识</th>
                <th class="flex-col" data-width="50%">模块介绍</th>
                <th class="flex-col text-center" data-width="100">分类功能</th>
                <th class="flex-col text-center" data-width="100">自定义字段</th>
                <th data-width="100" class="text-center">排序</th>
                <th data-width="80" class="text-center">修改</th>
                <th data-width="80" class="text-center">删除</th>
            </tr>
        </thead>
        <tbody>
            {volist name="list" id="vo"}
            <tr data-id="{$vo['module_id']}">
                <td>{$vo['module_id']}</td>
                <td>{$vo['module_name']}</td>
                <td>{$vo['module_path']}</td>
                <td><div class="text-nowrap text-ellipsis">{$vo['module_desc']}</div></td>
                <td class="text-center">{$vo->module_cate_html|raw}</td>
                <td class="text-center">{$vo->module_field_html|raw}</td>
                <td><input type="text" class="form-control sort text-center" data-url="{:url('/module/sort')}" data-old-sort="{$vo['module_sort']}" data-id="{$vo['module_id']}" value="{$vo['module_sort']}"></td>
                <td class="text-center">{if(check_auth('module-edit'))}<a data-toggle="modal" data-target="#modal-create" data-url="{:url('/module/edit', 'id='.$vo['module_id'])}" data-action="{:url('/module/update')}">修改</a>{/if}</td>
                <td class="text-center">{if(check_auth('module-delete'))}<a class="delete" data-url="{:url('/module/delete','id='.$vo['module_id'])}">删除</a>{/if}</td>
            </tr>
            {/volist}
        </tbody>
    </table>
    {empty name="list"}
    <div class="mb20 mt20 text-center">
        {if ($keywords!='')}
            未搜索到 “{$keywords}” 相关的模块 &nbsp; <a href="{:url('/module')}">查看全部模块</a>
        {else /}
            暂未添加模块
        {/if}
    </div>
    {/empty}
    {notempty name="list"}
    <div class="mb10 ml10">
        {if(check_auth('module-delete'))}<button class="btn btn-danger check-delete" type="button" data-url="{:url('/module/delete')}">删除模块</button>{/if}
    </div>
    {/notempty}
</div>
{include file="module/create" /}
{/block}



<!-- JS -->
{block name="js"}
    {load href="/static/lib/jquery/jquery.form.js"}
    {load href="/static/lib/jquery/jquery.autofill.min.js"}
    {load href="/static/lib/validator/validator.min.js"}
{/block}
{block name="jscode"}

{/block}